Advanced React component composition
Recap
We covered a lot of ground in this guide. Let’s finish by recapping the guiding principles for breaking down components and designing composition-based APIs:
Stable dependency principle: Is about creating APIs and components with the end user always in mind. We want to depend on things unlikely to change and hide the messy parts.
Single responsibility principle: Is about encapsulating a single concern. Easier to test, maintain and importantly - compose.
Inversion of control: Is about giving up the idea we can foresee every future use case and empower consumers to plug in their own stuff.